<?php
header("Content-Type: text/html;charset=utf-8"); 
session_start();

    require_once ('../Config/conn.php"');


	$datas = $db->select("user", array(
		"id",
		"username",
		"password"
	), array(
		"id" => 1,
	));

	foreach($datas as $v)
	{
		$id = $v["id"];
		$username = $v["username"];
		$password = $v["password"];
	}


  
	
    if($_GET['action']="login"){
	
	    if(md5($_GET['password']) == $password){
		
		 $_SESSION['id'] = $id;
         $_SESSION['username'] = $username;
         $HOST = $_SERVER['HTTP_HOST'];
         $_SESSION['host'] = $HOST;

		
		  echo '<style type="text/css">*{ padding: 0; margin: 0; } div{ padding: 4px 48px;} body{ background: #fff; font-family: "微软雅黑"; color: #333;font-size:24px} h1{ font-size: 100px; font-weight: normal; margin-bottom: 12px; } p{ line-height: 1.8em; font-size: 36px } a,a:hover,{color:blue;}</style><div style="padding: 24px 48px;"> <h1>:)</h1><p>登陆成功！</p>';
		  echo '<script>setTimeout(\'location="index.php"\', 2000);</script>';
		  exit;
		
		}else{
		
		  session_destroy ();
		   echo '<style type="text/css">*{ padding: 0; margin: 0; } div{ padding: 4px 48px;} body{ background: #fff; font-family: "微软雅黑"; color: #333;font-size:24px} h1{ font-size: 100px; font-weight: normal; margin-bottom: 12px; } p{ line-height: 1.8em; font-size: 36px } a,a:hover,{color:blue;}</style><div style="padding: 24px 48px;">  <h1>:(</h1><p>用户名或密码不正确！</p>';
		  echo '<script>setTimeout(\'location="login.php"\', 2000);</script>';
		  exit;
		};
	 
	}


?>